package com.java.date;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class DateTest {

    public static void main(String[] args) {
//       Date date = new Date();
//       System.out.println(date);
//       
//       System.out.println(date.getTime());
//       System.out.println(System.currentTimeMillis());
//       
//       SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 等价于now.toLocaleString()
//       Date now = new Date();
//       System.out.println(myFmt2.format(now));
       
//       long currentTime = System.currentTimeMillis();
//       SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//       Date date2 = new Date(currentTime);
//
//       System.out.println(formatter.format(date2));
        
        
        Calendar calendar= Calendar.getInstance();
        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        System.out.println(dateFormat.format(calendar.getTime()));
    }
}
